﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/Hui-iconfont/1.0.7/iconfont.css" rel="stylesheet" type="text/css" />

<title>新增客户</title>
</head>
<body>
 <div class="pd-20">
  <form  method="post" class="form form-horizontal" id="form1">
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>用户名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="${customer.userName}" placeholder="输入电话号码" id="userName" name="userName" readonly="readonly">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>初始密码：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="" placeholder="" id="pwd" name="pwd" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red"></span>别名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="nickName" id="nickName" value="${customer.nickName}" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red"></span>真实姓名：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="realName" id="realName" value="${customer.realName}" >
      </div>
      <div class="col-4"> </div>
    </div>
    
     <!-- <div class="row cl">
      <label class="form-label col-3">用户头像：</label>
      <div class="formControls col-5"> <span class="btn-upload form-group">
        <input class="input-text upload-url" type="text" name="image" id="image" readonly  style="width:200px">
        <a href="javascript:void();" class="btn btn-primary radius upload-btn"><i class="Hui-iconfont">&#xe642;</i> 浏览图片</a>
        <input type="file" multiple name="file-2" class="input-file">
        </span> </div>
      <div class="col-4"> </div>
    </div> -->
    
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>性别：</label>
      <div class="formControls col-5 skin-minimal">
        <div class="radio-box">
          <input type="radio" id="sex-1" name="gender" datatype="*" nullmsg="请选择性别！" value="1"  <c:if test="${customer.gender ==1}">checked="checked"</c:if> >
          <label for="sex-1">男</label>
        </div>
        <div class="radio-box">
          <input type="radio" id="sex-2" name="gender" value="2"  <c:if test="${customer.gender ==2}">checked="checked"</c:if>   >
          <label for="sex-2">女</label>
        </div>
        <!-- <div class="radio-box">
          <input type="radio" id="sex-3" name="gender" value="3">
          <label for="sex-3">保密</label>
        </div> -->
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>手机：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" value="${customer.mobileNumber}" placeholder="" id="mobileNumber" name="mobileNumber"  datatype="m" nullmsg="手机不能为空">
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>邮箱：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="@" name="email" id="email" datatype="e" nullmsg="请输入邮箱！" value="${customer.email}" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">出生日期：</label>
      <div class="formControls col-5">
       <input type="text"  onfocus="WdatePicker({dateFmt:'yyyy-MM-dd',minDate:'1960-01-01',maxDate:'2020-12-31'})" id="birthday" name="birthday" class="input-text Wdate" style="width:180px;" value="${customer.birthday}" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>身份证号：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="idCard" id="idCard"  value="${customer.idCard}"  >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3"><span class="c-red">*</span>常用地址：</label>
      <div class="formControls col-5">
        <input type="text" class="input-text" placeholder="" name="address" id="address"  value="${customer.address}" >
      </div>
      <div class="col-4"> </div>
    </div>
    <div class="row cl">
      <label class="form-label col-3">客户等级：</label>
      <div class="formControls col-5"> <span class="select-box">
           <select class="select"  size="1" id="customerLevel" name="customerLevel"  datatype="*" nullmsg="请选择客户等级！">
		      <option value="0"  <c:if test="${customer.customerLevel <=0}">selected="selected"</c:if>  >请选择</option>
		      <option value="1" <c:if test="${customer.customerLevel ==1}">selected="selected"</c:if> >金牌用户</option>
		      <option value="2" <c:if test="${customer.customerLevel ==2}">selected="selected"</c:if>>银牌用户</option>
		      <option value="3" <c:if test="${customer.customerLevel ==3}">selected="selected"</c:if> >铜牌用户</option>
		   </select>
        </span> </div>
      <div class="col-4"> </div>
    </div>
    <!-- <div class="row cl">
      <label class="form-label col-3">备注：</label>
      <div class="formControls col-5">
        <textarea name="" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" datatype="*10-100" dragonfly="true" nullmsg="备注不能为空！" onKeyUp="textarealength(this,100)"></textarea>
        <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
      </div>
      <div class="col-4"> </div>
    </div> -->
    <input type="hidden" id="id" name="id" value="${customer.id}">
    <div class="row cl">
      <div class="col-9 col-offset-3">
         <c:if test="${type != 3}">
            <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
         </c:if>
        &nbsp;&nbsp;<input id="closeBtn"  class="btn btn-primary radius" type="button" value="&nbsp;&nbsp;关闭&nbsp;&nbsp;">
      </div>
    </div>
  </form>
</div>
</div>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/layer/2.1/layer.js"></script>
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.js"></script> 
<script type="text/javascript" src="<%=basePath%>plugins/h_uiadmin_v2.3.4/js/H-ui.admin.js"></script>
<script type="text/javascript" src="<%=basePath%>common/js/cms.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form1").Validform({
		tiptype:2,
		beforeSubmit:function(curform){
			 //在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
            //这里明确return false的话表单将不会提交;
			submitForm(curform) ;
			return false ;
		},
		callback:function(form){
			
			// submitForm(form) ;
			// form[0].submit();
			return false ;
		}
	});
	
	function submitForm(form ){
		var params = JSON.stringify( $("#form1").serializeJson()) ;
		$.ajax({
			"type": "POST", 
			"url": "<%=basePath%>custmgr/doedit"  , 
		   // "contentType":"application/json;charset=UTF-8",   
			"dataType": "json",  // 预期服务器返回的数据类型
			"data": "params="+params ,      
			"success": function(resp) {
				// console.log(resp) ;
				if(resp.success){
					    var index = parent.layer.getFrameIndex(window.name);
						// parent.$('.btn-refresh').click();
						parent.$('#queryBtn').click(); 
						parent.layer.close(index);
				}else{
					// alert(resp.errMsg+",请重试!") ;
					layer.alert( resp.errMsg+",请重试!", {icon: 2},function(index){
						 layer.close(index);
					  });
				}
				 
			}
		}); 
	}
	
	
	$("#closeBtn").click(function(){
		var index = parent.layer.getFrameIndex(window.name);
		parent.layer.close(index);
	});
	
});
</script>
</body>
</html>